#tkinter_scale.py
#coding=utf-8
import tkinter
import tkinter.messagebox as mb

def showValues():
    mb.showinfo('Scale组件值',
                '第一个Sacle组件的值为：'+str(s1.get())+ \
                "\n第二个Scale组件的值为："+str(s2.get()))
    
#创建顶层窗口
topwin = tkinter.Tk()
#初始化窗口大小
topwin.geometry('250x200')  
#设置窗口标题
topwin.title('Scale组件测试')
#创建Scale组件，默认垂直放置
s1 = tkinter.Scale(topwin, from_=0, to=100)
s1.set(30) #设置初始值
s1.pack()
#创建Scale组件，水平放置
s2 = tkinter.Scale(topwin, from_=50, to=200, orient=tkinter.HORIZONTAL)
s2.set(80)
s2.pack()

b=tkinter.Button(topwin, text='点击显示Scale组件的值', command=showValues)
b.pack()

#进入主循环
topwin.mainloop()